/***************************************************************************
*   Copyright (C) 2011 by Chuck Gao & Alex Liu                             *
*                                                                          *
*   This program is free software: you can redistribute it and/or modify   *
*   it under the terms of the GNU General Public License as published by   *
*   the Free Software Foundation, either version 3 of the License, or      *
*   (at your option) any later version.                                    *
*                                                                          *
*   This program is distributed in the hope that it will be useful,        *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
*   GNU General Public License for more details.                           *
*                                                                          *
*   You should have received a copy of the GNU General Public License      *
*   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
*                                                                          *
*   Contact author: chuckgao.cg@gmail.com                                  *
*                   alex2202375@gmail.com                                  *
***************************************************************************/

import QtQuick 1.0
import com.nokia.symbian 1.1
import Qt.labs.components 1.1
import "../CookingBasicWidget"

Rectangle {
    id: briefView
    width: parent.width
    height: columnItemHeight * 5 + spacingLineHeight * 5 + tips.height + recipeTabView.contextMargin
    color: Qt.rgba(200,100,40,0.2)
    border.color: Qt.rgba(255,255,255,0.2)
    border.width: 2
    radius: 20

    property int columnItemHeight: 40
    property int leftMargin: 4
    property int spacingLineHeight: 2

    Column {
        Item {
            id: difficultLevel
            width: briefView.width
            height: briefView.columnItemHeight
            x: leftMargin
            Row {
                anchors.verticalCenter: parent.verticalCenter
                Text {
                    width: 80
                    anchors.verticalCenter: parent.verticalCenter
                    font.family: "Freestyle Script"
                    font.pointSize: 24
                    verticalAlignment: Text.AlignVCenter
                    color: "white"
                    text: "难易度"
                }

                Item {
                    id: difficultLevelLine
                    width: briefView.width - 80
                    height: 10
                    anchors.verticalCenter: parent.verticalCenter

                    StarRating {
                        width: 140
                        height: 24
                        anchors.centerIn: parent
                        ratingLevel: 3
                    }
                }
            }
        }

        Rectangle {
            color: "white"
            opacity: 0.2
            width: briefView.width
            height: spacingLineHeight
        }

        Item {
            id: flavor
            width: briefView.width
            height: briefView.columnItemHeight
            x: leftMargin
            Row {
                anchors.verticalCenter: parent.verticalCenter
                Text {
                    id: flavorText
                    width: 80
                    anchors.verticalCenter: parent.verticalCenter
                    font.family: "Freestyle Script"
                    font.pointSize: 24
                    color: "white"
                    text: "口味"
                }

                Item {
                    width: flavor.width - flavorText.width
                    height: flavor.height
                    anchors.verticalCenter: parent.verticalCenter
                    Text {
                        width: parent.width
                        anchors.centerIn: parent
                        font.family: "Freestyle Script"
                        font.pointSize: 24
                        horizontalAlignment: Text.AlignHCenter
                        verticalAlignment: Text.AlignVCenter
                        color: "white"
                        text: "微辣"
                    }
                }
            }
        }

        Rectangle {
            color: "white"
            opacity: 0.2
            width: briefView.width
            height: spacingLineHeight
        }

        Item {
            id: tech
            width: briefView.width
            height: briefView.columnItemHeight
            x: leftMargin
            Row {
                anchors.verticalCenter: parent.verticalCenter
                Text {
                    id: techText
                    width: 80
                    anchors.verticalCenter: parent.verticalCenter
                    font.family: "Freestyle Script"
                    font.pointSize: 24
                    color: "white"
                    text: "烹饪方式"
                }

                Item {
                    width: tech.width - techText.width
                    height: tech.height
                    anchors.verticalCenter: parent.verticalCenter
                    Text {
                        width: parent.width
                        anchors.centerIn: parent
                        font.family: "Freestyle Script"
                        font.pointSize: 24
                        horizontalAlignment: Text.AlignHCenter
                        verticalAlignment: Text.AlignVCenter
                        color: "white"
                        text: "爆炒"
                    }
                }
            }
        }

        Rectangle {
            color: "white"
            opacity: 0.2
            width: briefView.width
            height: spacingLineHeight
        }

        Item {
            id: prepareTime
            width: briefView.width
            height: briefView.columnItemHeight
            x: leftMargin
            Row {
                anchors.verticalCenter: parent.verticalCenter
                Text {
                    id: prepareTimeText
                    width: 80
                    anchors.verticalCenter: parent.verticalCenter
                    font.family: "Freestyle Script"
                    font.pointSize: 24
                    color: "white"
                    text: "准备时间"
                }

                Item {
                    width: prepareTime.width - prepareTimeText.width
                    height: prepareTime.height
                    anchors.verticalCenter: parent.verticalCenter
                    Text {
                        width: parent.width
                        anchors.centerIn: parent
                        font.family: "Freestyle Script"
                        font.pointSize: 24
                        horizontalAlignment: Text.AlignHCenter
                        verticalAlignment: Text.AlignVCenter
                        color: "white"
                        text: "15分钟"
                    }
                }
            }
        }

        Rectangle {
            color: "white"
            opacity: 0.2
            width: briefView.width
            height: spacingLineHeight
        }

        Item {
            id: evalutionTime
            width: briefView.width
            height: briefView.columnItemHeight
            x: leftMargin
            Row {
                anchors.verticalCenter: parent.verticalCenter
                Text {
                    id: evalutionTimeText
                    width: 80
                    anchors.verticalCenter: parent.verticalCenter
                    font.family: "Freestyle Script"
                    font.pointSize: 24
                    color: "white"
                    text: "烹饪时间"
                }

                Item {
                    width: evalutionTime.width - evalutionTimeText.width
                    height: evalutionTime.height
                    anchors.verticalCenter: parent.verticalCenter
                    Text {
                        width: parent.width
                        anchors.centerIn: parent
                        font.family: "Freestyle Script"
                        font.pointSize: 24
                        horizontalAlignment: Text.AlignHCenter
                        verticalAlignment: Text.AlignVCenter
                        color: "white"
                        text: "30分钟"
                    }
                }
            }
        }

        Rectangle {
            color: "white"
            opacity: 0.2
            width: briefView.width
            height: spacingLineHeight
        }

        Item {
            id: tips
            width: briefView.width
            height: briefView.columnItemHeight + content.height
            x: leftMargin
            Column {
                Item {
                    width: briefView.width
                    height: 40

                    Rectangle {
                        width: 70
                        height: 28
                        anchors.verticalCenter: parent.verticalCenter
                        radius: 12
                        color: "gray"
                        smooth: true
                        Text {
                            anchors.centerIn: parent
                            font.family: "Freestyle Script"
                            font.pointSize: 22
                            horizontalAlignment: Text.AlignHCenter
                            verticalAlignment: Text.AlignVCenter
                            color: "lightgreen"
                            text: "Tips"
                        }
                    }
                }

//                TextEdit {
//                    id: content
//                    width: tips.width
//                    height: content.paintedHeight
//                    x: leftMargin
//                    font.family: "Freestyle Script"
//                    font.pointSize: 32
//                    color: "white"
//                    wrapMode: TextEdit.Wrap
//                    cursorVisible: false
//                    readOnly: true
//                    text: "鲜香细嫩，微麻辣中而姜葱蒜味浓，主要突出以糊辣，荔枝味型，略带甜酸味道"
//                }

                TextArea {
                    id: content
                    width: tips.width - briefView.leftMargin * 2
                    height: content.paintedHeight
                    platformMaxImplicitWidth: tips.width - briefView.leftMargin * 2
                    font.family: "Freestyle Script"
                    font.pointSize: 32
//                    color: "white"
                    wrapMode: TextEdit.Wrap
                    readOnly: true
                    text: "鲜香细嫩，微麻辣中而姜葱蒜味浓，主要突出以糊辣，荔枝味型，略带甜酸味道"
                }
            }
        }
    }
}
